﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _38面向对象练习
{
    class Ticket
    {
        

        public double _dis;
        public double Dis
        {
            get { return _dis; }
        }

        public Ticket(double dis)
        {
            if (dis < 0)
            {
                dis = 0;
            }
            _dis = dis;
        }

        public double _num;
        public double Num
        {
            get
            {
                if (_dis > 0 && _dis <= 100)
                {
                    return _dis * 1.0;
                }
                else if (_dis >= 101 && _dis <= 200)
                {
                    return _dis * 0.95;
                }
                else if (_dis >= 201 && _dis <= 300)
                {
                    return _dis * 0.9;
                }
                else
                {
                    return _dis * 0.8;
                }
            }
        }

        public void Show()
        {
            Console.WriteLine("{0}公里收费{1}元",Dis,Num);
        }


    }
}
